package com.swanclouds.redfish.chassis.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.List;

public class NetworkPortsModel {

//    /**网络端口资源的访问路径**/
//    @JsonProperty("@odata.id")
//    private String dataId;
//
//    /**网络端口资源模型的OData描述信息**/
//    @JsonProperty("@odata.context")
//    private String context;
//
//    /**网络端口资源的类型**/
//    @JsonProperty("@odata.type")
//    private String type;

    /**网络端口资源ID**/
    @JsonProperty("Id")
    private String id;

    /**网络端口资源名称**/
    @JsonProperty("Name")
    private String name;

    /**指定网络端口的物理丝印**/
    @JsonProperty("PhysicalPortNumber")
    private String physicalPortNumber;

    /**指定网络端口的连接状态
     包括：
     ● Up
     ● Down**/
    @JsonProperty("LinkStatus")
    private String linkStatus;

    /**指定网络端口的网络地址，
     其中FC卡分为WWPN和
     WWNN，顺序为第一个为
     WWPN，第二个为WWNN**/
    @JsonProperty("AssociatedNetworkAddresses")
    private List<String> associatedNetworkAddresses;

    /**自定义属性**/
    @JsonProperty("Oem")
    private NetworkPortOem oem;

//    public String getDataId() {
//        return this.dataId;
//    }
//
//    public String getContext() {
//        return this.context;
//    }
//
//    public String getType() {
//        return this.type;
//    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getPhysicalPortNumber() {
        return physicalPortNumber;
    }

    public String getLinkStatus() {
        return linkStatus;
    }

    public List<String> getAssociatedNetworkAddresses() {
        return associatedNetworkAddresses;
    }

    public NetworkPortOem getOem() {
        return oem;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "NetworkPortsModel{" +
                " Id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", PhysicalPortNumber='" + physicalPortNumber + '\'' +
                ", LinkStatus='" + linkStatus + '\'' +
                ", AssociatedNetworkAddresses='" + associatedNetworkAddresses + '\'' +
                ", Oem='" + oem + '\'' +
                '}';
    }

    @JsonRootName("Oem")
    public static class NetworkPortOem {

        @JsonProperty("BMC")
        private NetworkPortBmc bmc;

        @JsonProperty("Huawei")
        private NetworkPortHuawei huawei;

        public NetworkPortBmc getBmc() {
            return bmc;
        }

        public NetworkPortHuawei getHuawei() {
            return huawei;
        }

        @JsonRootName("BMC")
        public static class NetworkPortBmc {
            /**
             * 网络端口的网口类型
             */
            @JsonProperty("PortType")
            private String portType;

            /**
             * 网络端口的固件版本
             */
            @JsonProperty("FirmwarePackageVersion")
            private String firmwarePackageVersion;

            /**
             * 网络端口的驱动版本
             */
            @JsonProperty("DriverVersion")
            private String driverVersion;

            /**
             * 网络端口的驱动名称
             */
            @JsonProperty("DriverName")
            private String driverName;

            @JsonProperty("BDF")
            private String bdf;

			public String getPortType() {
				return this.portType;
			}

			public void setPortType(String portType) {
				this.portType = portType;
			}

			public String getFirmwarePackageVersion() {
				return this.firmwarePackageVersion;
			}

			public void setFirmwarePackageVersion(String firmwarePackageVersion) {
				this.firmwarePackageVersion = firmwarePackageVersion;
			}

			public String getDriverVersion() {
				return this.driverVersion;
			}

			public void setDriverVersion(String driverVersion) {
				this.driverVersion = driverVersion;
			}

			public String getDriverName() {
				return this.driverName;
			}

			public void setDriverName(String driverName) {
				this.driverName = driverName;
			}

			public String getBdf() {
				return this.bdf;
			}

			public void setBdf(String bdf) {
				this.bdf = bdf;
			}
		}

		@JsonRootName("Huawei")
        public static class NetworkPortHuawei {
			/**
			 * 网络端口的网口类型
			 */
			@JsonProperty("PortType")
			private String portType;
			/**
			 * 网络端口的最大速率
			 */
			@JsonProperty("PortMaxSpeed")
			private String portMaxSpeed;
			/**
			 * 网络端口的名称
			 */
			@JsonProperty("PortName")
			private String portName;
			/**
			 * 网络端口的接口类型
			 */
			@JsonProperty("InterfaceType")
			private String interfaceType;
			/**
			 * BDF
			 */
			@JsonProperty("BDF")
			private String bdf;
			/**
			 * 网络端口的固件版本
			 */
			@JsonProperty("FirmwarePackageVersion")
			private String firmwarePackageVersion;

			/**
			 * 网络端口的驱动版本
			 */
			@JsonProperty("DriverVersion")
			private String driverVersion;
			/**
			 * 网络端口的驱动名称
			 */
			@JsonProperty("DriverName")
			private String driverName;
			/**
			 * 网口上接的光模块资
			 * 源
			 */
			@JsonProperty("OpticalModule")
			private String opticalModule;
			/**
			 * 网络端口的网络协议
			 * ● Ethernet
			 * ● FibreChannel
			 * ● iSCSI
			 * ● FCoE
			 * ● OPA
			 * ● IB
			 */
			@JsonProperty("PortTechnology")
			private String portTechnology;
			/**
			 * FC卡的ID
			 */
			private String fCId;
			/**
			 * FC卡的端口状态
			 * ● Online
			 * ● LinkDown
			 * ● Kffl²n
			 * ● User Kffl²n
			 * ● Bypassed
			 * ● In diagnostics mode
			 * ● Port Error
			 * ● Loopback
			 * ● Degraded
			 */
			private String portState;
			/**
			 * 网络端口的速率 仅支持FC卡
			 */
			private String linkSpeedGbps;
			private String relatedPort;
			private String statisticInfo;
			/**
			 * HBA卡端口的发送速率
			 */
			private Double tXRateGbps;
			/**
			 * HBA卡端口的接收速率
			 */
			private Double rXRateGbps ;
			/**
			 * HBA卡端口的工作模式，包括：
			 * ● Loop
			 * ● NonLoop
			 */
			private String workMode;
			/**
			 * HBA卡端口的本段设备信用值
			 */
			private Integer localDeviceCredit;
			/**
			 * HBA卡端口的对端设备信用值
			 */
			private Integer peerDeviceCredit;
			/**
			 * HBA卡端口的端口连接状态，包括：
			 * ● LinkUp
			 * ● Disabled
			 * ● WaitSignal
			 */
			private String portStatus ;

			public String getPortType() {
				return this.portType;
			}

			public void setPortType(String portType) {
				this.portType = portType;
			}

			public String getPortMaxSpeed() {
				return this.portMaxSpeed;
			}

			public void setPortMaxSpeed(String portMaxSpeed) {
				this.portMaxSpeed = portMaxSpeed;
			}

			public String getPortName() {
				return this.portName;
			}

			public void setPortName(String portName) {
				this.portName = portName;
			}

			public String getInterfaceType() {
				return this.interfaceType;
			}

			public void setInterfaceType(String interfaceType) {
				this.interfaceType = interfaceType;
			}

			public String getBdf() {
				return this.bdf;
			}

			public void setBdf(String bdf) {
				this.bdf = bdf;
			}

			public String getFirmwarePackageVersion() {
				return this.firmwarePackageVersion;
			}

			public void setFirmwarePackageVersion(String firmwarePackageVersion) {
				this.firmwarePackageVersion = firmwarePackageVersion;
			}

			public String getDriverVersion() {
				return this.driverVersion;
			}

			public void setDriverVersion(String driverVersion) {
				this.driverVersion = driverVersion;
			}

			public String getDriverName() {
				return this.driverName;
			}

			public void setDriverName(String driverName) {
				this.driverName = driverName;
			}

			public String getOpticalModule() {
				return this.opticalModule;
			}

			public void setOpticalModule(String opticalModule) {
				this.opticalModule = opticalModule;
			}

			public String getPortTechnology() {
				return this.portTechnology;
			}

			public void setPortTechnology(String portTechnology) {
				this.portTechnology = portTechnology;
			}

			public String getfCId() {
				return this.fCId;
			}

			public void setfCId(String fCId) {
				this.fCId = fCId;
			}

			public String getPortState() {
				return this.portState;
			}

			public void setPortState(String portState) {
				this.portState = portState;
			}

			public String getLinkSpeedGbps() {
				return this.linkSpeedGbps;
			}

			public void setLinkSpeedGbps(String linkSpeedGbps) {
				this.linkSpeedGbps = linkSpeedGbps;
			}

			public String getRelatedPort() {
				return this.relatedPort;
			}

			public void setRelatedPort(String relatedPort) {
				this.relatedPort = relatedPort;
			}

			public String getStatisticInfo() {
				return this.statisticInfo;
			}

			public void setStatisticInfo(String statisticInfo) {
				this.statisticInfo = statisticInfo;
			}

			public Double gettXRateGbps() {
				return this.tXRateGbps;
			}

			public void settXRateGbps(Double tXRateGbps) {
				this.tXRateGbps = tXRateGbps;
			}

			public Double getrXRateGbps() {
				return this.rXRateGbps;
			}

			public void setrXRateGbps(Double rXRateGbps) {
				this.rXRateGbps = rXRateGbps;
			}

			public String getWorkMode() {
				return this.workMode;
			}

			public void setWorkMode(String workMode) {
				this.workMode = workMode;
			}

			public Integer getLocalDeviceCredit() {
				return this.localDeviceCredit;
			}

			public void setLocalDeviceCredit(Integer localDeviceCredit) {
				this.localDeviceCredit = localDeviceCredit;
			}

			public Integer getPeerDeviceCredit() {
				return this.peerDeviceCredit;
			}

			public void setPeerDeviceCredit(Integer peerDeviceCredit) {
				this.peerDeviceCredit = peerDeviceCredit;
			}

			public String getPortStatus() {
				return this.portStatus;
			}

			public void setPortStatus(String portStatus) {
				this.portStatus = portStatus;
			}
		}
    }
}
